#include<stdio.h>
#include<stdlib.h>

int main(){
    FILE *fp; //定义文件指针
    fp=fopen("f1.txt","w");
    if(fp== NULL)
    {printf("打开文件失败\n");
    exit(0);}
    fprintf(fp,"Hello World!");
     if(fclose(fp)){printf("关闭文件失败\n");
    exit(0);}
   

    return 0;
 }